﻿using System.Runtime.Serialization;
using System;

namespace Common.Utilities.Excel.Import
{
    /// <summary>
    /// 单元格读取的值的类型
    /// </summary>
    public enum DataTypeEnums
    {
        /// <summary>
        /// 字符型
        /// </summary>
        [EnumMember (Value="String")]
        String = 0,
        /// <summary>
        /// 数字类型
        /// </summary>
        [EnumMember (Value="Numeric")]
        Numeric,
        /// <summary>
        /// 日期类型
        /// </summary>
        [EnumMember (Value="DateTime")]
        DateTime,
        /// <summary>
        /// Guid
        /// </summary>
        [EnumMember (Value="Guid")]
        Guid
    }

    /// <summary>
    /// 得到DataTypeEnums的系统类型
    /// </summary>
    public class DataTypeEnumsSystemType
    {
        public static Type GetType(DataTypeEnums enums)
        {
            switch (enums)
            {
                case DataTypeEnums.DateTime:
                    return typeof(DateTime);
                case DataTypeEnums.Guid:
                    return typeof(Guid);
                case DataTypeEnums.Numeric:
                    return typeof(System.Double);
                case DataTypeEnums.String:
                    return typeof(String);
                default:
                    return typeof(String);
            }
        }
    }

    /// <summary>
    /// 单元格读取的值的类型
    /// </summary>
    public enum DefaultValueSourceEnum
    {
        /// <summary>
        /// 静态
        /// </summary>
        [EnumMember (Value="Constant")]
        Constant = 0,
        /// <summary>
        /// 属性
        /// </summary>
        [EnumMember (Value="Property")]
        Property,
        /// <summary>
        /// 域
        /// </summary>
        [EnumMember (Value="Field")]
        Field,
        /// <summary>
        /// 方法
        /// </summary>
        [EnumMember (Value="Method")]
        Method
    }
}